package edu.xmut.kakamusic.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowInsets;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.core.view.WindowInsetsControllerCompat;

import edu.xmut.kakamusic.R;
import edu.xmut.kakamusic.utils.WindowUtils;

public class LauncherActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_launcher);
        doLoadingLauncherAnimation();

    }

    private void doLoadingLauncherAnimation() {
        new Handler().postDelayed(() -> {
            SharedPreferences sp = getSharedPreferences("settings", Context.MODE_PRIVATE);
            boolean isFirst = sp.getBoolean("isFirst", true);
            if (isFirst) {
                Intent intent = new Intent(LauncherActivity.this, IntroductionActivity.class);
                startActivity(intent);
                sp.edit().putBoolean("isFirst", false).apply();
            } else {
                Intent intent = new Intent(LauncherActivity.this, SplashActivity.class);
                startActivity(intent);
            }
            finish();
        }, 1000);

    }
}